import React, {useState} from 'react'
import {Button} from "antd";

export default function UseStateFun(){
    const [num,setNum]=useState(0)
    function addNum(){
        // setNum(num+1)
        setNum((num)=>num+2)
    }
    return(
        <div>
            <h2>使用useState状态相关</h2>
            <span>num:{num}</span>
            <Button onClick={addNum}>加num</Button>
        </div>
    )
}
